<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
	<head th:replace="~{commons/public::common-public}">
		<meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
		<meta http-equiv="X-UA-Compatible" content="IE=8" />
		<title>新增员工</title>
	</head>

	<body>
	<div id="wrapper">
		<header th:replace="~{commons/header::common-header(activeUrl='user')}"></header>
		<div id="page-wrapper">
			<div class="container-fluid">
				<!-- Page Heading -->
				<div class="row">
					<div class="col-lg-12">
						<h1 class="page-header" th:text="用户信息"></h1>
						<ol class="breadcrumb">
							<li><i class="fa fa-dashboard"></i> <a href="/main" th:text="主页"></a>
							</li>
							<li class="active"><i class="fa fa-table"></i> <span th:text="用户信息"></span></li>
						</ol>
					</div>
				</div>
				<div class="row" th:if="${not #strings.isEmpty(message)}">
					<div class="col-lg-12">
						<div class="alert alert-info alert-dismissable">
							<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
							<i class="fa fa-info-circle"></i> <strong th:text="${message}"></strong>
						</div>
					</div>
				</div>
				<div class="row col-lg-10">
					<form th:action="@{/stu}" method="post">
						<!--发送put请求修改员工数据-->
						<!--
						1、SpringMVC中配置HiddenHttpMethodFilter;（SpringBoot自动配置好的）
						2、页面创建一个post表单
						3、创建一个input项，name="_method";值就是我们指定的请求方式
						-->
						<input type="hidden" name="_method" value="PUT" th:if="${stu!=null}" />
						
						<input type="hidden" name="stuId" th:if="${stu!=null}" th:value="${stu.stuId}">
						
						<div class="form-group">
							<label th:text="#{stuName}"></label>
							<input name="stuName" type="text" class="form-control" placeholder="学生姓名" th:value="${stu!=null}?${stu.stuName}">
						</div>
						<div class="form-group">
							<label th:text="#{stuAge}"></label>
							<input name="stuAge" type="text" class="form-control" placeholder="你多大了" th:value="${stu!=null}?${stu.stuAge}">
						</div>
						<div class="form-group">
							<label th:text="#{password}"></label>
							<input name="password" type="text" class="form-control" placeholder="请输入密码"  th:value="${stu!=null}?${stu.password}">
						</div>
						<div class="form-group">
							<label th:text="#{school}"></label>
							<input name="school" type="text" class="form-control" placeholder="请输入学校"  th:value="${stu!=null}?${stu.school}">
						</div>
						<div class="form-group">
							<label th:text="#{address}"></label>
							<input name="address" type="text" class="form-control" placeholder="请输入地址"  th:value="${stu!=null}?${stu.address}">
						</div>
						<div class="form-group">
							<label th:text="#{gender}"></label>
							<div class="form-check form-check-inline">
								<input class="form-check-input" type="radio" name="gender" value="1" th:checked="${stu!=null}?${stu.gender==1}">
								<label class="form-check-label" th:text="男"></label>
								<input class="form-check-input" type="radio" name="gender" value="0" th:checked="${stu!=null}?${stu.gender==0}">
								<label class="form-check-label" th:text="女"></label>
							</div>
						</div>

						<div class="form-group">
							<label th:text="#{birthday}"></label>
							<input name="birthday" type="text" class="form-control" placeholder="格式: 2018/04/11 11:22:33" th:value="${stu!=null}?${#dates.format(stu.birthday, 'yyyy-MM-dd HH:mm')}">
						</div>
						<button type="submit" class="btn btn-primary" th:text="${stu!=null}?'更新':'添加'"></button>
					</form>
				</div>
			</div>
		</div>
	</div>
	</body>
</html>